'use strict';

/* Controllers */


function createOrganizationCtrl($scope,$http,$location,$stateParams) {

	$scope.createOrganization=function(){
		$scope.orgData.logo = $scope.image2.file;
		$http.post('organizations', $scope.orgData).success(function(data) {
			$location.path('/dashboard/organizations');
		});

	};

}

createOrganizationCtrl.$inject = ['$scope','$http','$location','$stateParams'];//inject required

function organizationCtrl($scope,$http,$location,$stateParams){


	$http.get('organizations').success(function(data) {
		data=eval(data);
		$scope.requestReferences = {};
		$scope.requests = data;
		for(var i = 0; i < $scope.requests.length; i++) {
			$scope.requestReferences[$scope.requests[i].id] = i;
		}		
	});

}

organizationCtrl.$inject = ['$scope','$http','$location','$stateParams'];//inject required